<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductInventoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('product_inventories', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('product_id')->unique()->comment('产品ID');
            $table->unsignedBigInteger('customer_id')->comment('客户ID');
            $table->unsignedInteger('usable')->comment('可用')->default(0);
            $table->unsignedInteger('unusable')->comment('不可用')->default(0);
            $table->unsignedInteger('locked')->comment('出库锁定')->default(0);
            $table->unsignedInteger('outbound')->comment('出库')->default(0);
            $table->unsignedInteger('expired')->comment('过期')->default(0);
            $table->integer('anomalous')->comment('来货异常数')->default(0);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_inventories');
    }
}
